package com.my.chapter12;

public class practice4 {
    static void f() throws MyException4{
        System.out.println("Throwing MyException from f()");
        throw new MyException4("Originated in f()");
    }

    public static void main(String[] args) {
        try {
            f();
        }catch (MyException4 e){
            e.display();
        }
    }
}

class MyException4 extends Exception{
    private String msg;

    public MyException4(String msg){
        this.msg = msg;
    }

    public void display(){
        System.out.println(msg);
    }
}

